#include<bits/stdc++.h>
#define ONLINE_JUDGE
#define ll long long
#define ull unsigned long long
using namespace std;

const int N = 15, INF = 0x3f3f3f3f;
const int d[4][2] = { {1,0},{-1,0},{0,1},{0,-1} };

int n, m, k, ans;
char a[N][N];
bool st[N][N];

void print()
{
    for (int i = 1;i <= n;i++) {
        for (int j = 1;j <= m;j++)
            cout << st[i][j];
        cout << '\n';
    }
    cout << '\n';
}

void dfs(int x, int y, int len)
{
    if (len == k) { ans++; return; }
    for (int i = 0;i < 4;i++) {
        int nx = x + d[i][0], ny = y + d[i][1];
        if (nx >= 1 && nx <= n && ny >= 1 && ny <= m && a[nx][ny] == '.' && st[nx][ny] == 0) {
            st[nx][ny] = 1;
            dfs(nx, ny, len + 1);
            st[nx][ny] = 0;
        }
    }
}

void solve()
{
    cin >> n >> m >> k;
    for (int i = 1;i <= n;i++)
        for (int j = 1;j <= m;j++)
            cin >> a[i][j];

    for (int i = 1;i <= n;i++)
        for (int j = 1;j <= m;j++) {
            if (a[i][j] == '#') continue;
            st[i][j] = 1;
            dfs(i, j, 0);
            st[i][j] = 0;
        }
    cout << ans;
}

signed main()
{
    // ios::sync_with_stdio(0);
    // cin.tie(0);cout.tie(0);
#ifndef ONLINE_JUDGE
    std::istringstream in(R"()");
    std::cin.rdbuf(in.rdbuf());
#endif
    int T = 1;
    //cin>>T;
    for (int i = 1;i <= T;i++) {
        solve();
    }
}